 /*
  * Mango CMS
  * Copyright 2008, Mango Web, and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
package org.mangocms.model.user;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Security role
 * 
 * @author <a href="tanordheim@gmail.com">Trond Arve Nordheim</a>
 * @version $Revision: 1.1 $
 */
@Entity
@Table(name = "mango_roles")
public class Role implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@Column(name = "id")
	@Id @GeneratedValue
	private Integer id;
	
	@Column(name = "version")
	@Version
	private Integer version;
	
	@Column(name = "name")
	@Length(max = 100)
	@NotNull
	private String name;

	/** 
	 * Create a new Role.
	 */
	public Role() {
	}
	
	/**
	 * Create a new Role.
	 * 
	 * @param name
	 */
	public Role(String name) {
		this.name = name;
	}

	/**
	 * Get the id.
	 * 
	 * @return the id.
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * Set the id.
	 * 
	 * @param id The id to set.
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * Get the version.
	 * 
	 * @return the version.
	 */
	public Integer getVersion() {
		return version;
	}

	/**
	 * Set the version.
	 * 
	 * @param version The version to set.
	 */
	public void setVersion(Integer version) {
		this.version = version;
	}

	/**
	 * Get the name.
	 * 
	 * @return the name.
	 */
	public String getName() {
		return name;
	}

	/**
	 * Set the name.
	 * 
	 * @param name The name to set.
	 */
	public void setName(String name) {
		this.name = name;
	}

}
